package dao;

import org.hibernate.Session;

import dominio.Factura;

public class FacturaDAO {
	private static FacturaDAO instance = null;

	public static FacturaDAO getInstance() {
		if (instance == null)
			instance = new FacturaDAO();
		return instance;
	}

	private FacturaDAO() {}

	public int guardarFactura(Factura factura) {
		Session s = HibernateDAO.getInstance().getSession();
		s.beginTransaction();
		s.saveOrUpdate(factura);
		s.getTransaction().commit();
		return factura.getId();
	}
}